package j05fanxing;

import java.util.Random;

public class J1 {
    public static void main(String[] args) {
        int[] arr = {1,4,5};
        Object[] objArr = {
                new Random(),
                new J1()
        };
    }
}

//创建泛型类,只接受引用类型
//T - type
class Cat<T>{
    T a;

    void f1(T t){
        System.out.println("t = " + t);
    }
    T f2(T t){
        return t;
    }

//    static void f3(T t){
//
//    }
}
class CatTest{
    public static void main(String[] args) {
        Cat<String> cat = new Cat<String>();
        cat.a="abc";
        System.out.println("cat.a = " + cat.a);

        Cat<Integer> cat1 = new Cat<>();
        cat1.a=3;
        cat1.f1(33);

        System.out.println(cat1.f2(100));//100
    }
}
